/**
 * Copyright (c) 2009-2011, chunquedong(YangJiandong)
 * 
 * This file is part of ChunMap project
 * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE(Version >=3)
 * 
 * History:
 *     2010-05-05  Jed Young  Creation
 */
package chunmap.app.command;

import chunmap.model.elem.Envelope;
import chunmap.app.MapCtrl;
import chunmap.app.bench.Command;

public class ExtentCommand  implements Command {
	private MapCtrl map;
	private Envelope oldEnvelope;
	private Envelope envelope;

	public ExtentCommand(MapCtrl map,Envelope envelope) {
		this.map = map;
		this.envelope=envelope;
	}

	@Override
	public void execute() {
		oldEnvelope=map.getView().getViewEnvelop();
		map.getView().setViewEnvelop(envelope);
	}

	@Override
	public boolean isUndoable() {
		return true;
	}

	@Override
	public void rollback() {
		map.getView().setViewEnvelop(oldEnvelope);
	}
}